package com.liang.hash;

import java.util.HashSet;

public class HashDemo1 {
    public static void main(String[] args) {
        HashSet<Student> set = new HashSet<>();
        Student stu1 = new Student("xiaohei", 22);
        Student stu2 = new Student("xiaohei", 22);
        Student stu3 = new Student("xiaomei", 23);

        set.add(stu1);
        set.add(stu2);
        set.add(stu3);


        System.out.println(set);

        /*Iterator<Student> it = set.iterator();
        while (it.hasNext()) {
            Student next = it.next();
            System.out.println(next);
        }*/

        for (Student student : set) {
            System.out.println(student);

        }

    }
}
